package cn.magic.service.impl;

import cn.magic.Store;
import cn.magic.ajax.AjaxResult;
import cn.magic.domain.Product;
import cn.magic.feignclient.StoreFeignClient;
import cn.magic.mapper.ProductMapper;
import cn.magic.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class IProdectServiceimpl implements ProductService {
    @Autowired
    private ProductMapper productMapper;
    @Autowired
    private StoreFeignClient storeFeignClient;


    @Override
    public void save(Product product) {
        productMapper.save(product);
        Store store = new Store(null,product.getId(),product.getNumber());
        AjaxResult save = storeFeignClient.save(store);
        System.out.println(save.getMessage());

    }

}
